﻿Public Partial Class Formulario_web17
    Inherits System.Web.UI.Page

    Dim ocnEgresados As New CapaNegocio.Egresados()


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        cargargrilla(Me.TextBoxNroExpediente.Text)
    End Sub

    Function cargargrilla(ByVal nroExpediente As String)
        Dim ds As New DataSet

        ds = ocnEgresados.obtenerEgresados()

        Me.GridViewEgresados.DataSource = ds.Tables(0)

        Me.GridViewEgresados.DataBind()
        Return Me.GridViewEgresados
    End Function



    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
        Try
            ocnEgresados.InsertarEgresado(Me.TextBoxNroExpediente.Text _
                                          , Me.TextBoxDniAlumno.Text _
                                          , CDate(Me.TextBoxFecha.Text))


            cargargrilla(Me.TextBoxNroExpediente.Text)
        Catch ex As Exception
            Session.Add("exError", ex)
            Response.Redirect("ManejarError.aspx")
        End Try

    End Sub

    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click
        Try
            cargargrilla(Me.TextBoxNroExpediente.Text)
        Catch ex As Exception
            Session.Add("exError", ex)
            Response.Redirect("ManejarError.aspx")
        End Try
    End Sub

    Protected Sub Button3_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button3.Click
        Try
            Me.TextBoxDniAlumno.Text = ocnEgresados.BuscarDniExpediente(Me.TextBoxNroExpediente.Text)
            Me.TextBoxNombreAlumno.Text = ocnEgresados.BuscarNombreExpediente(Me.TextBoxNroExpediente.Text)
        Catch ex As Exception
            Session.Add("exError", ex)
            Response.Redirect("ManejarError.aspx")
        End Try
    End Sub
End Class